import { createApp } from 'vue'
import axios from '@/plugins/axios'
import App from '@/App.vue'
import router from '@/router'
import store from '@/store'
import installElementPlus from '@/plugins/element'
import elementIcon from '@/plugins/svgicon'
import permission from '@/plugins/permission'
import mock from '@/plugins/mock'
import directives from '@/directives'
import veBaseComponents from '@/components/veBaseComponents'
import * as Elicons from '@element-plus/icons-vue' // 全局引用element-icon
import 'normalize.css/normalize.css'
import 'nprogress/nprogress.css'
import '@/styles/common.scss'

// SSO-AUTH-HEADER=LONG87f0f0921dd745678f4badc50c31df04
// 设置cookie
document.cookie =
    'SSO-AUTH-HEADER=LONG87f0f0921dd745678f4badc50c31df04; domain=.bestwehotel.com; path=/'
const app = createApp(App)

// 注册Icons 全局组件
Object.keys(Elicons).forEach((key) => {
    app.component(key, Elicons[key])
})

app.use(mock)
    .use(elementIcon)
    .use(veBaseComponents)
    .use(store)
    .use(router)
    .use(installElementPlus)
    .use(axios, { router, store, opt: 'VE_API' })
    .use(permission, { router, store })
    .use(directives, { router, store })
    .mount('#app')
